#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include "src/baseui/arrowwidget.h"
#include "src/authenticate/loginlogical.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
   explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();


    void initSystemEnv();
    void restoreSystemEnv();

    void startRetrylockTimer();
public slots:

    void initDateTime();
    void initUserName();
    void initToolButtons();

    void onShowhelpClicked();
    void onKeyboardClicked();
    void onBatteryClicked();
    void onSystemrebootClicked();


    void onLoginEnter(const QString& passwd);
    void onLoginResult(Loginlogical::Login_Result result, const QString& resultMsg);

    void onPasswdLockerTimeout();

    void setFacelockArrowwidgetVisible(bool visible);
    void onFaceAuthClicked();
    void onFaceAuthResult(Loginlogical::Face_Predict_Result result);

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;

private:
    Ui::MainWindow *ui;
    ArrowWidget* m_arrowWidget;
    ArrowWidget* m_faceArrowWidget;
    QTimer m_updateTimer;
    Loginlogical m_loginlogical;
    QTimer m_retryTimer;

    quint32 m_faceRetryCount;
};
#endif // MAINWINDOW_H
